package com.halixun.d2app.bean;

import android.text.TextUtils;

import androidx.annotation.NonNull;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * @ProjectName: D2App
 * @Package: com.halixun.d2app.bean
 * @ClassName: OrderListInfo
 * @Description: java类作用描述
 * @Author: hdx
 * @CreateDate: 2019/11/28 19:18
 * @UpdateUser: hdx
 * @UpdateDate: 2019/11/28 19:18
 * @UpdateRemark: 更新说明：
 * @Version: 1.0
 */
public class OrderListInfo implements Serializable ,Cloneable{

    public OrderListInfo getConeInfo(){
        OrderListInfo info = new OrderListInfo();
        info.setSelected(this.isSelected());
        info.setCommodityNumber(this.getCommodityNumber());
        info.setClassID(this.getClassID());
        info.setDescription(this.getDescription());
        List<FoodSkuListBean> list = new ArrayList<>();
        for (FoodSkuListBean foodSkuListBean : this.FoodSkuList){
            list.add(foodSkuListBean.getConeInfo());
        }
        info.setFoodSkuList(list);
        info.setID(this.getID());
        info.setIsError(this.isIsError());
        info.setIsEveryDay(this.isIsEveryDay());
        info.setIsMember(this.getIsMember());
        info.setIsOnlyShop(this.isIsOnlyShop());
        info.setJianPin(this.getJianPin());
        info.setOldPrice(this.getOldPrice());
        info.setPic(this.getPic());
        info.setPinYin(this.getPinYin());
        info.setPrice(this.getPrice());
        info.setPutaway(this.getPutaway());
        info.setSalesNum(this.getSalesNum());
        info.setSpecialOffer(this.getSpecialOffer());
        info.setStock(this.getStock());
        info.setTitle(this.getTitle());
        info.setTodaySalesNum(this.getTodaySalesNum());
        info.setType(this.getType());
        info.setUnit(this.getUnit());
        return info;
    }

    @NonNull
    @Override
    public OrderListInfo clone() throws CloneNotSupportedException {
        OrderListInfo info = (OrderListInfo) super.clone();
        if (!TextUtils.isEmpty(Title)){
            info.setTitle(new StringBuffer(Title).toString());
        }
        if (!TextUtils.isEmpty(Pic)){
            info.setPic(new StringBuffer(Pic).toString());
        }
        if (!TextUtils.isEmpty(Unit)){
            info.setUnit(new StringBuffer(Unit).toString());
        }
        if (!TextUtils.isEmpty(JianPin)){
            info.setJianPin(new StringBuffer(JianPin).toString());
        }

        if (!TextUtils.isEmpty(PinYin)){
            info.setPinYin(new StringBuffer(PinYin).toString());
        }
        if (!TextUtils.isEmpty(Description)){
            info.setDescription(new StringBuffer(Description).toString());
        }
        List<FoodSkuListBean> list = new ArrayList<>();
        for (FoodSkuListBean skuListBean : FoodSkuList){
            list.add(skuListBean.clone());
        }
        info.setFoodSkuList(list);
        return info;
    }

    private int commodityNumber = 1;

    private boolean selected = false;


    private FoodSkuListBean type;

    private int ID;
    private String Title;
    private double Price;
    private double OldPrice;
    private int SalesNum;
    private String Pic;
    private int ClassID;
    private String Unit;
    private int SpecialOffer;
    private String JianPin;
    private String PinYin;
    private boolean IsEveryDay;
    private int Stock;
    private int Putaway;
    private String Description;
    private int IsMember;
    private boolean IsError;
    private int TodaySalesNum;
    private boolean IsOnlyShop;
    private List<FoodSkuListBean> FoodSkuList;


    public OrderListInfo() {
    }

    public int getCommodityNumber() {
        return commodityNumber;
    }

    public void setCommodityNumber(int commodityNumber) {
        this.commodityNumber = commodityNumber;
    }

    public boolean isSelected() {
        return selected;
    }

    public void setSelected(boolean selected) {
        this.selected = selected;
    }

    public FoodSkuListBean getType() {
        return type;
    }

    public void setType(FoodSkuListBean type) {
        this.type = type;
    }

    public int getID() {
        return ID;
    }

    public void setID(int ID) {
        this.ID = ID;
    }

    public String getTitle() {
        return Title;
    }

    public void setTitle(String Title) {
        this.Title = Title;
    }

    public double getPrice() {
        return Price;
    }

    public void setPrice(double Price) {
        this.Price = Price;
    }

    public double getOldPrice() {
        return OldPrice;
    }

    public void setOldPrice(double OldPrice) {
        this.OldPrice = OldPrice;
    }

    public int getSalesNum() {
        return SalesNum;
    }

    public void setSalesNum(int SalesNum) {
        this.SalesNum = SalesNum;
    }

    public String getPic() {
        return Pic;
    }

    public void setPic(String Pic) {
        this.Pic = Pic;
    }

    public int getClassID() {
        return ClassID;
    }

    public void setClassID(int ClassID) {
        this.ClassID = ClassID;
    }

    public String getUnit() {
        return Unit;
    }

    public void setUnit(String Unit) {
        this.Unit = Unit;
    }

    public int getSpecialOffer() {
        return SpecialOffer;
    }

    public void setSpecialOffer(int SpecialOffer) {
        this.SpecialOffer = SpecialOffer;
    }

    public String getJianPin() {
        return JianPin;
    }

    public void setJianPin(String JianPin) {
        this.JianPin = JianPin;
    }

    public String getPinYin() {
        return PinYin;
    }

    public void setPinYin(String PinYin) {
        this.PinYin = PinYin;
    }

    public boolean isIsEveryDay() {
        return IsEveryDay;
    }

    public void setIsEveryDay(boolean IsEveryDay) {
        this.IsEveryDay = IsEveryDay;
    }

    public int getStock() {
        return Stock;
    }

    public void setStock(int Stock) {
        this.Stock = Stock;
    }

    public int getPutaway() {
        return Putaway;
    }

    public void setPutaway(int Putaway) {
        this.Putaway = Putaway;
    }

    public String getDescription() {
        return Description;
    }

    public void setDescription(String Description) {
        this.Description = Description;
    }

    public int getIsMember() {
        return IsMember;
    }

    public void setIsMember(int IsMember) {
        this.IsMember = IsMember;
    }

    public boolean isIsError() {
        return IsError;
    }

    public void setIsError(boolean IsError) {
        this.IsError = IsError;
    }

    public int getTodaySalesNum() {
        return TodaySalesNum;
    }

    public void setTodaySalesNum(int TodaySalesNum) {
        this.TodaySalesNum = TodaySalesNum;
    }

    public boolean isIsOnlyShop() {
        return IsOnlyShop;
    }

    public void setIsOnlyShop(boolean IsOnlyShop) {
        this.IsOnlyShop = IsOnlyShop;
    }

    public List<FoodSkuListBean> getFoodSkuList() {
        return FoodSkuList;
    }

    public void setFoodSkuList(List<FoodSkuListBean> FoodSkuList) {
        this.FoodSkuList = FoodSkuList;
    }

    public static class FoodSkuListBean implements Serializable , Cloneable{
        /**
         * ID : 3
         * Name : 份
         * Price : 0.01
         * ProductID : 22
         */

        private int ID;
        private String Name;
        private double Price;
        private int ProductID;

        @NonNull
        @Override
        protected FoodSkuListBean clone() throws CloneNotSupportedException {
            FoodSkuListBean skuListBean = (FoodSkuListBean) super.clone();
            if (TextUtils.isEmpty(Name)){
                skuListBean.setName(new StringBuffer(Name).toString());
            }
            return skuListBean;
        }

        public FoodSkuListBean getConeInfo(){
            FoodSkuListBean bean = new FoodSkuListBean();
            bean.setID(this.ID);
            bean.setName(this.Name);
            bean.setPrice(this.Price);
            bean.setProductID(this.ProductID);
            return bean;
        }


        public FoodSkuListBean(){}

        public int getID() {
            return ID;
        }

        public void setID(int ID) {
            this.ID = ID;
        }

        public String getName() {
            return Name;
        }

        public void setName(String Name) {
            this.Name = Name;
        }

        public double getPrice() {
            return Price;
        }

        public void setPrice(double Price) {
            this.Price = Price;
        }

        public int getProductID() {
            return ProductID;
        }

        public void setProductID(int ProductID) {
            this.ProductID = ProductID;
        }
    }
}
